package com.young.scheduler.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.9.0)",
    comments = "Source: ShedulerService.proto")
public final class VClientSheduleServiceGrpc {

  private VClientSheduleServiceGrpc() {}

  public static final String SERVICE_NAME = "grpc.VClientSheduleService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @Deprecated // Use {@link #getDoJobMethod()} instead.
  public static final io.grpc.MethodDescriptor<SchedulerModel.JobRequest,
      SchedulerModel.JobResponse> METHOD_DO_JOB = getDoJobMethod();

  private static volatile io.grpc.MethodDescriptor<SchedulerModel.JobRequest,
      SchedulerModel.JobResponse> getDoJobMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<SchedulerModel.JobRequest,
      SchedulerModel.JobResponse> getDoJobMethod() {
    io.grpc.MethodDescriptor<SchedulerModel.JobRequest, SchedulerModel.JobResponse> getDoJobMethod;
    if ((getDoJobMethod = VClientSheduleServiceGrpc.getDoJobMethod) == null) {
      synchronized (VClientSheduleServiceGrpc.class) {
        if ((getDoJobMethod = VClientSheduleServiceGrpc.getDoJobMethod) == null) {
          VClientSheduleServiceGrpc.getDoJobMethod = getDoJobMethod =
              io.grpc.MethodDescriptor.<SchedulerModel.JobRequest, SchedulerModel.JobResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "grpc.VClientSheduleService", "doJob"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  SchedulerModel.JobRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  SchedulerModel.JobResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new VClientSheduleServiceMethodDescriptorSupplier("doJob"))
                  .build();
          }
        }
     }
     return getDoJobMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static VClientSheduleServiceStub newStub(io.grpc.Channel channel) {
    return new VClientSheduleServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static VClientSheduleServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new VClientSheduleServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static VClientSheduleServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new VClientSheduleServiceFutureStub(channel);
  }

  /**
   */
  public static abstract class VClientSheduleServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void doJob(SchedulerModel.JobRequest request,
                      io.grpc.stub.StreamObserver<SchedulerModel.JobResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getDoJobMethod(), responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getDoJobMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                SchedulerModel.JobRequest,
                SchedulerModel.JobResponse>(
                  this, METHODID_DO_JOB)))
          .build();
    }
  }

  /**
   */
  public static final class VClientSheduleServiceStub extends io.grpc.stub.AbstractStub<VClientSheduleServiceStub> {
    private VClientSheduleServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VClientSheduleServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VClientSheduleServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VClientSheduleServiceStub(channel, callOptions);
    }

    /**
     */
    public void doJob(SchedulerModel.JobRequest request,
                      io.grpc.stub.StreamObserver<SchedulerModel.JobResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getDoJobMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class VClientSheduleServiceBlockingStub extends io.grpc.stub.AbstractStub<VClientSheduleServiceBlockingStub> {
    private VClientSheduleServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VClientSheduleServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VClientSheduleServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VClientSheduleServiceBlockingStub(channel, callOptions);
    }

    /**
     */
    public SchedulerModel.JobResponse doJob(SchedulerModel.JobRequest request) {
      return blockingUnaryCall(
          getChannel(), getDoJobMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class VClientSheduleServiceFutureStub extends io.grpc.stub.AbstractStub<VClientSheduleServiceFutureStub> {
    private VClientSheduleServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private VClientSheduleServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected VClientSheduleServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new VClientSheduleServiceFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<SchedulerModel.JobResponse> doJob(
        SchedulerModel.JobRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getDoJobMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_DO_JOB = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final VClientSheduleServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(VClientSheduleServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_DO_JOB:
          serviceImpl.doJob((SchedulerModel.JobRequest) request,
              (io.grpc.stub.StreamObserver<SchedulerModel.JobResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @Override
    @SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class VClientSheduleServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    VClientSheduleServiceBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.young.scheduler.grpc.ShedulerService.getDescriptor();
    }

    @Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("VClientSheduleService");
    }
  }

  private static final class VClientSheduleServiceFileDescriptorSupplier
      extends VClientSheduleServiceBaseDescriptorSupplier {
    VClientSheduleServiceFileDescriptorSupplier() {}
  }

  private static final class VClientSheduleServiceMethodDescriptorSupplier
      extends VClientSheduleServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    VClientSheduleServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (VClientSheduleServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new VClientSheduleServiceFileDescriptorSupplier())
              .addMethod(getDoJobMethod())
              .build();
        }
      }
    }
    return result;
  }
}
